home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: 100754.2730@compuserve.com (Martin Aupperle)
- Newsgroups: comp.lang.c++
- Subject: Re: beginner question - typecasting
- Date: Mon, 08 Jan 1996 08:08:21 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4cqjq4$337@dub-news-svc-1.compuserve.com>
- References: <4cei1r$s02@sun.cis.smu.edu> <30EAFDFC.BF0@softint.com>
- NNTP-Posting-Host: ad35-142.compuserve.com
- X-Newsreader: Forte Free Agent v0.56
-
- Rud Merriam <rmerriam@softint.com> wrote:
-
- >> The specific example given is:
- >>
- >> int i = 2;
- >> float a, b;
- >> a = float(i);
- >> b = (float) i;
- >>
- >> In this example, would a and b return the same value and have the same
- >> data type (float)?
-
- >Yes they would. Use the functional notation because it is more easily
- >understood, IMO. Potentially the (float) form could be eliminated from the
- >language sometime in the future.
-
- Hopefully not! The second form is the only one possible if the target
- type consists of more than one keyword, e.g.
-
- void f ( const void* p ) {
- const char *str = (const char*)p;
-
- /* ... */
- }
-
- I know that this is a type cast and not a conversion.
-
-
-
- -----------------------------------
- Signatures are a waste of bandwidth
- -----------------------------------
-
-